netfront: Better fix for netfront_tx_slot_available().
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Thu, 25 Jan 2007 16:58:21 +0000 (16:58 +0000)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Thu, 25 Jan 2007 16:58:21 +0000 (16:58 +0000)
Signed-off-by: Keir Fraser <keir@xensource.com>
linux-2.6-xen-sparse/drivers/xen/netfront/netfront.c

index 01ccb15b72cdaf0633d47ec0c90bb0b2bfe3f79f..f54cc84b89f9d59c7c154650bfb0ff8da62ea8fb 100644 (file)
@@ -613,11 +613,8 @@ static int network_open(struct net_device *dev)
 
 static inline int netfront_tx_slot_available(struct netfront_info *np)
 {
-       /* XXX Need to check we have enough grants for worst-case fragments. */
-       if (gnttab_empty_grant_references(&np->gref_tx_head))
-               return 0;
-
-       return RING_FREE_REQUESTS(&np->tx) >= MAX_SKB_FRAGS + 2;
+       return ((np->tx.req_prod_pvt - np->tx.rsp_cons) <
+               (TX_MAX_TARGET - MAX_SKB_FRAGS - 2));
 }
 
 static inline void network_maybe_wake_tx(struct net_device *dev)